cmake_minimum_required(VERSION 3.14)
project(protobuf)
find_package(Protobuf REQUIRED)
# 添加包含路径
add_subdirectory(proto)
# 添加生成的头文件搜索路径为build后的路径
message(STATUS "##############"${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_executable(read read.cc)
add_executable(write write.cc)
target_link_libraries(read proto ${PROTOBUF_LIBRARY})
target_link_libraries(write proto ${PROTOBUF_LIBRARY})